<?php

	$con = mysql_connect("localhost", "root", "root");
	if (!$con) {
	    die("couldn't connect " . mysql_error());
	}
	mysql_select_db("jianglaifarm", $con);
	$sql = "insert into plant (NAME,EXP,FRUIT_NUM,FRUIT_PRICE,
	            LEVEL,SEED_PRICE,RIPE_TIME) values('$_POST[name]','$_POST[exp]',"
	        . "'$_POST[fruit_num]','$_POST[fruit_price]','$_POST[level]',"
	        . "'$_POST[seed_price]','$_POST[ripe_time]')";
	if (!mysql_query($sql, $con)) {
	    die('Error: ' . mysql_error());
	}
	header('Refresh: 0; listPlant.php');
	exit();
	mysql_close($con);
?>

